#! /usr/bin/env python
# -*- coding: UTF-8 -*-
__author__ = 'xcma'

import jsonpath

d = {'code': 200, 'msg': None, 'data': {'red_packet_uuid': '29859768a1e2966ee4cfafc85a8faf95', 'app_id': '02391153', 'third_party_user_id': '23300045', 'source_id': '18465477', 'type': 0, 'describe': '', 'number': 1, 'amount': '1', 'condition': 0, 'password': '', 'push_channel': 'ch_f8ddb2d8', 'start_time': '2020-09-14 15:06:31', 'joined_user_count': 0, 'get_user_count': 0, 'online_user_count': 1, 'get_amount': 0, 'refund_status': 0, 'pay_status': 0, 'trade_no': '', 'ext': '', 'deleted': 0, 'created_at': '2020-09-14 15:05:32', 'updated_at': None, 'deleted_at': None, 'gift_type': 1, 'red_packet_id': '9133'}}
def getDictKey(key=None, target=None):
    fv= target if target else  f'$..{key}'
    return fv
rs = jsonpath.jsonpath(d, '$..red_packet_id')
print(type(rs))

